cmake_minimum_required(VERSION 3.15)

project(QCustomPlot)

# QT env configuration
set(CMAKE_INCLUDE_CURRENT_DIR ON)
set(CMAKE_AUTOUIC ON)
set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTORCC ON)
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD_REQUIRED ON)

find_package(QT NAMES Qt5 COMPONENTS 
    Core 
    Widgets
    PrintSupport
    REQUIRED
)
find_package(Qt${QT_VERSION_MAJOR} COMPONENTS 
    Core 
    Widgets
    PrintSupport
    REQUIRED
)
add_library(QCustomPlot STATIC 
    include/qcustomplot.h
    src/qcustomplot.cpp
)
add_library(utils::QCustomPlot ALIAS QCustomPlot)

target_include_directories(QCustomPlot
    PUBLIC
    ${PROJECT_SOURCE_DIR}/include
    PRIVATE
    ${Qt5Core_DIR}/../../../include
    ${Qt5Core_DIR}/../../../include/QtCore
    Qt${QT_VERSION_MAJOR}::Core
    Qt${QT_VERSION_MAJOR}::Widgets
    Qt${QT_VERSION_MAJOR}::PrintSupport
    utils::QLogger
)
target_link_libraries(QCustomPlot
    PUBLIC
    Qt${QT_VERSION_MAJOR}::Core
    Qt${QT_VERSION_MAJOR}::Widgets
    Qt${QT_VERSION_MAJOR}::PrintSupport
    utils::QLogger
)
